// scaup - Scala up!
// (c) 2008-2010, Normen Müller, normen.mueller@gmail.com  
// $Id: EQ.scala 80 2010-05-13 12:31:58Z normen.mueller $
package scaup.parsing.eq

import java.io.File
import java.text.MessageFormat.{format}

/** This object provides a simple interface to the equivalence specification parser class.
 * 
 *  EQ syntax:
 * 
 *  <eqspec> ::= `equivspec' ID <dtd>? <ext>? `{' <elem>* `}'
 *  <dtd>    ::= `for' DOCTYPE
 *  <ext>    ::= `extends' ID
 *  <elem>   ::= `unordered'? `element' NAME `{' <alt> `}' \alt `unordered'? `element' NAME <body>
 *  <alt>    ::= `alternative' `{' <body>+ `}'
 *  <body>   ::= `{' <annos>? <consts>? `}'
 *  <annos>  ::= `annotations' `{' (<nopts> | <allbut>) `}'
 *  <consts> ::= `constituents' `{' <oconst>? <uconst>? `}'
 *  <oconst> ::= `ordered' `{' (<nopts> | <allbut>) `}'
 *  <uconst> ::= `unordered' `{' (<nopts> | <allbut>) `}'
 *  <allbut> ::= (`_' | `*') `\textbackslash' `{' <names> `}'
 *  <nopts>  ::= <nopt> | <nopt> , <nopts>
 *  <nopt>   ::= NAME | NAME`?'
 *  <names>  ::= NAME | NAME , <names>
 * 
 *  @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 *  @version 0.0.5
 * 
 *  @thanks Serge Autexier for their initial discussions on the declartive syntax.
 */
object EquivalenceSpecificationParser extends Parser {    
  def parse(input: String) = phrase(eqsys)(new lexical.Scanner(input)) match {
    case Success(result, _) => result
    case n@_                => error(format("DOT parsing error in\n{0}\n\n", input) + n)                                                     
  }  
}
